package 结构型模型.享元模式;

import java.util.HashMap;
import java.util.Map;

public class XYFactory {
    private static Map<String,AbstractXY> map=new HashMap<>();
    public static AbstractXY getxy(String c){
        if (map.containsKey(c)) {
            return map.get(c);
        }else{
            XY xy= new XY(c);
            map.put(c,xy);
            return xy;
        }
    }

}
